import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// 导入element
import './plugins/element.js'
Vue.config.productionTip = false
// 全局路由守卫
router.beforeEach((to, from, next) => {
  let a = null
    let data = sessionStorage.getItem("token")
    a = (data == null ? false : true)
    if (to.path == "/login") {
      if (a == true) {
        next("/admin/index")
      }
    } else {
      if (a == false) {
        next("login")

      }
    }




  // // console.log(to.meta.bread)
  // // 判断to里面有没有meta这个属性v
  // if (to.hasOwnProperty("meta")) {
  //   store.commit("bread", to.meta.bread)
  // }
  next()
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
